<script type="text/javascript">
	var form_url = '/weixin/news/add/category' ;
	$(function() {
		
		if(null != "" && "${id!}" != "") {
			form_url = '/weixin/news/update/category' ;
			$.get('/weixin/news/get/category/${id!}', function(result) {
				try {
					$('#form').form('load', result);
				} catch(e) {
					$.easyui.loaded(); console.error(e) ;
				}
			}, 'JSON').complete(function(){$.easyui.loaded();});
		}		
	});
	
	function submitForm() {
		var checkform = $('#form').form('validate');
		if(checkform) {
			$.easyui.loading();
			$.post(form_url, MM.getData('#form', true), function(result) {
				try {
					if(result.code == 200) {
						$obj.category_reload();$window.window('close');alertify.success(result.message);
					} else {
						$.messager.alert('提示信息', result.message, 'warning') ;
					}
				} catch(e) {
					$.easyui.loaded(); console.error(e) ;
				}
			}, 'JSON').complete(function(){$.easyui.loaded();});
		}
	}
</script>

<div class="easyui-panel form-panel" data-options="border: false, fit: true">
	<form id="form" method="post">
		<input type="hidden" name="id" value="${id!}">
		<table class="table-form">
			<tr>
				<th>类别名称：</th>
				<td><input class="easyui-textbox" name="category" style="width:180px" data-options="required:true,validateOnCreate:false,validateOnBlur:true"></td>
			</tr>
			<tr>
				<th>类别状态：</th>
				<td>
					<select class="easyui-combobox" name="status" style="width:180px;" data-options="required:true, editable: false, panelHeight:'auto'">
		                <option value="1">正常</option>
		                <option value="0">禁用</option>
		            </select>
				</td>
			</tr>
			<tr>
				<th>类别排序：</th>
				<td><input class="easyui-numberbox" name="orderNum" value="100" style="width:180px" data-options="min:100, max: 9999,required:true,validateOnCreate:false,validateOnBlur:true"></td>
			</tr>
		</table>
	</form>
</div>

<div class="submit-toolbar" id="footer"  style="border-bottom: 0;border-left: 0;border-right: 0;">
	<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="submitForm()" style="width:80px">提交</a>
	<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="MM.closeCurrentWindow()" style="width:80px">关闭</a>
</div>

